<?php


namespace App\Controller;


use Hyperf\SocketIOServer\BaseNamespace;

abstract class AbstractWebSocketController extends BaseNamespace
{

    public function errMsg($msg = '错误！', $data = [], $code = -1)
    {
        return [
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ];
    }

    public function closeMsg($msg = '错误！', $data = [], $code = -2)
    {
        return [
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ];
    }

    public function sucMsg($data = [], $msg = '成功！', $code = 0)
    {
        return [
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ];
    }


}